import {URL, connection, express} from './_comm'

const router = express.Router();
const sql = 'SELECT * FROM jo_user';
/* GET users listing. */
router.get('/', (req, res, next) => {
  console.log('asdf');
  res.send('jo_user');
});
/* GET home page. */
router.get('/list', (req, res, next) => {
  let params = URL.parse(req.url, true).query;
  connection.query(sql, (err, result) => {
    if (err) {
      console.log('[SELECT ERROR] - ', err.message);
      return;
    }
    console.log(params.id);
    console.log('result:', result);
    //把搜索值输出
    res.json({"success": true, data: result});
  });
});

module.exports = router;
